function ZcCalendar(opts) {
	/*	
		author：@张超 158425724
		version:1.0
		date:2017-11-21
		desc:纯原生js完成，不依赖$，可对接vue，显示的星期顺序为左起日一二...
	*/

	var _this = this;
	var opts = opts||{},
		currTime = new Date(),
		//容器dom,可以传递id或者直接传递dom，暂不支持class
		container = typeof opts.container==='string'?( document.getElementById(opts.container) ):(opts.container),
		year = opts.year||currTime.getFullYear(),
		month = opts.month||( currTime.getMonth()+1 ),//代表当前显示的月份，取值1~12
		priceJson = opts.priceJson||{},
		monthCount = opts.monthCount,//要显示几个月
		clkFn = opts.clkFn,//点击天函数
		tmpStr = '',
		currDay = new Date(),
		oTime=new Date( year,(month-1),1 ),//传递的起始年月||系统的当前年月
		//每月的最大天数。getDate()获取日期
		maxDay = new Date(year,month-1,0).getDate(),
		//当月第一天是周几                                    
		firstDay =oTime.getDay(),
		//每一天是几号
		evyDay = -1,
		// 每一天的时间戳，以用来准备一个时间对象&与传递的priceJson比对
		tmpDay = -1,
		//每月最多6周
		currWeekCount = 6,
		// 每一天可能携带的信息
		mayArr = [],
		//每一天的集合
		zcDivs = null,
		zcDivLen = 0,
		//以天为单位的时间戳(以系统时间为准)
		today = Date.parse( currDay.getFullYear()+'/'+(currDay.getMonth()+1)+'/'+currDay.getDate() );

		// $container=$(container)
	for(var i=0;i<monthCount;i++) { //要展示的月数为monthCount
		if(i===0) {
			oTime = new Date(year,month-1);//当前月份的时间对象
		}else {
			oTime = new Date(year,month);
		}
		firstDay =oTime.getDay();//更新每月的第一天
		year = oTime.getFullYear();//当month为12时跨年解决
		month = oTime.getMonth()+1;//跨月解决
		maxDay = new Date(year,month,0).getDate();
		tmpStr+=(
			'<ul>'+
				'<li>'+
					'<p class="month-title">'+year+'年'+month+'月</p>'+
				'</li>'
		);
		// console.log(firstDay);
		currWeekCount = weeks(firstDay,maxDay);
		for(var j=0;j<currWeekCount;j++) {//最多六周一定可以展示一个月的所有日期@zc20171117
			tmpStr+='<li class="zc-week clearfix" data-week='+i+'*'+j+'>';
			for(var k=1;k<=7;k++){//每一周最多七天
				evyDay = (k-firstDay) + (7*j);//依据第几周和当月的1号是周几来计算每一天是几号
				// console.log(evyDay);
				if(evyDay<1||evyDay>maxDay) { //非正常日期只用来站位不展示
					tmpStr+='<div class="blank zc-day"></div>'
				}else { //正常日期区分是今天还是非今天
					// tmpDay = Date.parse(year+'/'+(month)+'/'+evyDay);
					tmpDay = new Date(year,month-1,evyDay).getTime();
					oTime = new Date(tmpDay);//更新时间对象
					tmpStr += '<div id='+tmpDay+'';
					mayArr = priceJson[tmpDay];
					if(today==tmpDay) {//标志今天
						tmpStr+=' class="curr-day zc-day">今天'
					}else {
						tmpStr+=' class=zc-day>'+evyDay;
					}
					if(mayArr) {
						tmpStr+=renderPrice(mayArr);
					}
					tmpStr+='</div>'
				}

			};
			tmpStr+='</li>';
		}
		tmpStr+='</ul>';

	}

	container.innerHTML = tmpStr;

	zcDivs = container.getElementsByClassName('zc-day');

	zcDivLen = zcDivs.length;

	for(var n=0;n<zcDivLen;n++) {
		zcDivs[n].addEventListener('click',function(ev) {
			var high_day = container.getElementsByClassName('zc-day curr-day')[0];
			if( _this.hasClass(this,'blank')||_this.hasClass(this,'curr-day') ) {//点击在无日期的div上或者已被选中的div上
				clkFn(this,this);
				return;
			}
			// 添加和去除高亮样式的操作不再在插件里完成
			// _this.removeClass(high_day,'curr-day');
			// _this.addClass(this,'curr-day');
			clkFn(this,high_day);
			return;
		})
	}
	
	
	function weeks(firstDay,lastDay) {//根据月份第一天是周几，最后一天是几号，计算出当月的周数
		var firstWeekDays = 7-firstDay+1;
		var remainWeeks = Math.ceil( (lastDay-firstWeekDays)/7 );
		return 1+remainWeeks;
	}

	function renderPrice(arr) {
		var priceArr=[];
		$.each(arr, function(i, obj) {
			priceArr.push(
				'<div data-tip='+obj.tip+' class="zc-data '+(obj.cls||'')+'">',
					'<span>'+obj.tip+'</span>',
					'<span>'+obj.val+'</span>',
				'</div>'
			);
		});
		return priceArr.join('');
	}
	this.hasClass = function(obj,cls) {
		return obj?( ( obj.className||' ').match(new RegExp("(\\s|^)" + cls + "(\\s|$)")) ):false;
		
	};
	this.addClass = function(obj,cls) {
		var obj_class = obj.className;
		if(!_this.hasClass(obj,cls)) {
			obj_class +=' '+cls;
			obj.className = obj_class;
		}
	};
	this.removeClass = function(obj,cls) {
		var reg;
		if (_this.hasClass(obj, cls)) {   
	        reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');  
	        obj.className = obj.className.replace(reg, ' ');  
	    }  
	};
}

/*

	var asd = new CreateCalendar({
		container:'zc-month-wp',
		// container:document.getElementById('zc-month-wp'),
		monthCount:6,//显示的月的个数
		priceJson:{
			1511366400000:[
				{tip:'￥',val:val.price},
				{tip:'童价:',val:val.childPrice},
				{tip:'库存:',val:val.stock,cls:'kucun-zc-test'},
			],
		},
		// year:'2013',//起始年份
		// month:'8',//起始月份
		clkFn:function(dom) {
			console.log(dom);
		}
	});

*/